package com.itheima.d4_inner_class4;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Test {
    public static void main(String[] args) {
        //匿名内部类
        //GUI编程，窗口编程
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 300);
        //匿名内部类
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowOpened(WindowEvent e) {
                System.out.println("窗口打开了");
            }
        });
        frame.setVisible(true);
        //匿名内部类
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                System.out.println("窗口关闭了");
            }
        });
        frame.setVisible(true);
        //登录按钮
        JButton button = new JButton("登录");
        frame.add(button);

    }
}
